package com.helpustotravel.model.jdo;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.Text;

@PersistenceCapable
public class Help {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    
    /**
     * Deuxieme identifiant unique
     */
    @Persistent
    private String session;

    @Persistent
    private String prenom;
    
    @Persistent
    private String email;
    
    @Persistent
    private String ip;
    
    @Persistent
    private String travellerName;
    
    @Persistent
    private long positionId;
    
    @Persistent
    private Date date;
    
    @Persistent
    private Text comment;
    
    @Persistent
    private String localisation;
    
    @Persistent
    private String search;
    
    public Help() {
    	this.session = null;
    	this.date = null;
    	this.prenom = "";
    	this.email = "";
    	this.ip = "";
    	this.travellerName = "";
    	this.positionId = 0;
    	this.comment = new Text("");
    	this.localisation = "";
    	this.search = "";
    }

	public Key getKey() {
		return key;
	}

	public void setKey(Key key) {
		this.key = key;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public Date getDate() {
		return date;
	}

	public String getTravellerName() {
		return travellerName;
	}

	public void setTravellerName(String travellerName) {
		this.travellerName = travellerName;
	}

	public long getPositionId() {
		return positionId;
	}

	public void setPositionId(long positionId) {
		this.positionId = positionId;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getComment() {
		return comment.getValue();
	}

	public void setComment(String comment) {
		this.comment = new Text(comment);
	}

	public String getSession() {
		return session;
	}

	public void setSession(String session) {
		this.session = session;
	}

	public void generateSession() {
		this.session = (new Date()).toString();
	}

	public String getLocalisation() {
		return localisation;
	}

	public void setLocalisation(String localisation) {
		this.localisation = localisation;
	}

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		this.search = search;
	}
}
